{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import xarray as xr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
       " *\n",
       " */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
       "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
       "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
       "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
       "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
       "  --xr-background-color: var(--jp-layout-color0, white);\n",
       "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
       "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
       "}\n",
       "\n",
       "html[theme=dark],\n",
       "body[data-theme=dark],\n",
       "body.vscode-dark {\n",
       "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
       "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
       "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
       "  --xr-border-color: #1F1F1F;\n",
       "  --xr-disabled-color: #515151;\n",
       "  --xr-background-color: #111111;\n",
       "  --xr-background-color-row-even: #111111;\n",
       "  --xr-background-color-row-odd: #313131;\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  display: block !important;\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "}\n",
       "\n",
       ".xr-text-repr-fallback {\n",
       "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-array-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: '►';\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: '▼';\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "  padding-bottom: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: '(';\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: ')';\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: ',';\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-index-preview {\n",
       "  grid-column: 2 / 5;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data,\n",
       ".xr-index-data {\n",
       "  display: none;\n",
       "  background-color: var(--xr-background-color) !important;\n",
       "  padding-bottom: 5px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data,\n",
       ".xr-index-data-in:checked ~ .xr-index-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-index-name div,\n",
       ".xr-index-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data,\n",
       ".xr-index-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt,\n",
       ".xr-attrs dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2,\n",
       ".xr-no-icon {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
       "Dimensions:  (time: 9404, lat: 3, lon: 4)\n",
       "Coordinates:\n",
       "  * lon      (lon) float32 110.0 111.0 112.0 113.0\n",
       "  * lat      (lat) float32 24.0 25.0 26.0\n",
       "  * time     (time) datetime64[ns] 1996-10-01 1996-10-02 ... 2022-06-30\n",
       "Data variables:\n",
       "    precip   (time, lat, lon) float32 ...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-02de6ed2-a778-4381-91b8-193c52f5ae4a' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-02de6ed2-a778-4381-91b8-193c52f5ae4a' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>time</span>: 9404</li><li><span class='xr-has-index'>lat</span>: 3</li><li><span class='xr-has-index'>lon</span>: 4</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-a296e66e-7f88-496b-be4d-b687c03f6de7' class='xr-section-summary-in' type='checkbox'  checked><label for='section-a296e66e-7f88-496b-be4d-b687c03f6de7' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>lon</span></div><div class='xr-var-dims'>(lon)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>110.0 111.0 112.0 113.0</div><input id='attrs-c66ecebe-851e-4c76-8f82-cad25b94e83f' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-c66ecebe-851e-4c76-8f82-cad25b94e83f' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-cf61d106-b209-44f2-a65f-64ea7f7214c5' class='xr-var-data-in' type='checkbox'><label for='data-cf61d106-b209-44f2-a65f-64ea7f7214c5' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([110., 111., 112., 113.], dtype=float32)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>lat</span></div><div class='xr-var-dims'>(lat)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>24.0 25.0 26.0</div><input id='attrs-838ee4db-0800-4ceb-88dc-3afb0050c337' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-838ee4db-0800-4ceb-88dc-3afb0050c337' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-4e9d96e2-5ec1-456b-b904-2ad01c98fda2' class='xr-var-data-in' type='checkbox'><label for='data-4e9d96e2-5ec1-456b-b904-2ad01c98fda2' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([24., 25., 26.], dtype=float32)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>1996-10-01 ... 2022-06-30</div><input id='attrs-ec5efc76-bfdd-4aa0-b006-2512658ade06' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-ec5efc76-bfdd-4aa0-b006-2512658ade06' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-61bad66e-2635-42ee-8c26-461c6e5b867d' class='xr-var-data-in' type='checkbox'><label for='data-61bad66e-2635-42ee-8c26-461c6e5b867d' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array([&#x27;1996-10-01T00:00:00.000000000&#x27;, &#x27;1996-10-02T00:00:00.000000000&#x27;,\n",
       "       &#x27;1996-10-03T00:00:00.000000000&#x27;, ..., &#x27;2022-06-28T00:00:00.000000000&#x27;,\n",
       "       &#x27;2022-06-29T00:00:00.000000000&#x27;, &#x27;2022-06-30T00:00:00.000000000&#x27;],\n",
       "      dtype=&#x27;datetime64[ns]&#x27;)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-254ae5a3-da1e-429b-aefe-63643bf3a146' class='xr-section-summary-in' type='checkbox'  checked><label for='section-254ae5a3-da1e-429b-aefe-63643bf3a146' class='xr-section-summary' >Data variables: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>precip</span></div><div class='xr-var-dims'>(time, lat, lon)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-fe4b1d09-76a5-4cc1-be16-f804f62029d4' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-fe4b1d09-76a5-4cc1-be16-f804f62029d4' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-e583af60-13ed-4993-97d0-683913fc5c96' class='xr-var-data-in' type='checkbox'><label for='data-e583af60-13ed-4993-97d0-683913fc5c96' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>[112848 values with dtype=float32]</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-870a3c38-3166-4bbd-b31a-674293a54c64' class='xr-section-summary-in' type='checkbox'  ><label for='section-870a3c38-3166-4bbd-b31a-674293a54c64' class='xr-section-summary' >Indexes: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>lon</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-a22843ef-7ffd-483a-8d50-d74c532872d7' class='xr-index-data-in' type='checkbox'/><label for='index-a22843ef-7ffd-483a-8d50-d74c532872d7' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([110.0, 111.0, 112.0, 113.0], dtype=&#x27;float64&#x27;, name=&#x27;lon&#x27;))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>lat</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-4905ca33-ee64-429a-bd88-b14826a291e4' class='xr-index-data-in' type='checkbox'/><label for='index-4905ca33-ee64-429a-bd88-b14826a291e4' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([24.0, 25.0, 26.0], dtype=&#x27;float64&#x27;, name=&#x27;lat&#x27;))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>time</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-c923ba6a-0d7e-4886-9333-69709c32617b' class='xr-index-data-in' type='checkbox'/><label for='index-c923ba6a-0d7e-4886-9333-69709c32617b' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(DatetimeIndex([&#x27;1996-10-01&#x27;, &#x27;1996-10-02&#x27;, &#x27;1996-10-03&#x27;, &#x27;1996-10-04&#x27;,\n",
       "               &#x27;1996-10-05&#x27;, &#x27;1996-10-06&#x27;, &#x27;1996-10-07&#x27;, &#x27;1996-10-08&#x27;,\n",
       "               &#x27;1996-10-09&#x27;, &#x27;1996-10-10&#x27;,\n",
       "               ...\n",
       "               &#x27;2022-06-21&#x27;, &#x27;2022-06-22&#x27;, &#x27;2022-06-23&#x27;, &#x27;2022-06-24&#x27;,\n",
       "               &#x27;2022-06-25&#x27;, &#x27;2022-06-26&#x27;, &#x27;2022-06-27&#x27;, &#x27;2022-06-28&#x27;,\n",
       "               &#x27;2022-06-29&#x27;, &#x27;2022-06-30&#x27;],\n",
       "              dtype=&#x27;datetime64[ns]&#x27;, name=&#x27;time&#x27;, length=9404, freq=None))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-a7fa4959-3411-4050-8a17-2d9188b19499' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-a7fa4959-3411-4050-8a17-2d9188b19499' class='xr-section-summary'  title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
      ],
      "text/plain": [
       "<xarray.Dataset>\n",
       "Dimensions:  (time: 9404, lat: 3, lon: 4)\n",
       "Coordinates:\n",
       "  * lon      (lon) float32 110.0 111.0 112.0 113.0\n",
       "  * lat      (lat) float32 24.0 25.0 26.0\n",
       "  * time     (time) datetime64[ns] 1996-10-01 1996-10-02 ... 2022-06-30\n",
       "Data variables:\n",
       "    precip   (time, lat, lon) float32 ..."
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pre1=xr.open_dataset('./data/precip_daily.nc')\n",
    "pre1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "d:\\anaconda\\envs\\py310\\lib\\site-packages\\xarray\\coding\\times.py:699: SerializationWarning: Unable to decode time axis into full numpy.datetime64 objects, continuing using cftime.datetime objects instead, reason: dates out of range\n",
      "  dtype = _decode_cf_datetime_dtype(data, units, calendar, self.use_cftime)\n",
      "d:\\anaconda\\envs\\py310\\lib\\site-packages\\xarray\\core\\indexing.py:524: SerializationWarning: Unable to decode time axis into full numpy.datetime64 objects, continuing using cftime.datetime objects instead, reason: dates out of range\n",
      "  return np.asarray(array[self.key], dtype=None)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n",
       "<defs>\n",
       "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n",
       "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n",
       "</symbol>\n",
       "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n",
       "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n",
       "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n",
       "</symbol>\n",
       "</defs>\n",
       "</svg>\n",
       "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n",
       " *\n",
       " */\n",
       "\n",
       ":root {\n",
       "  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n",
       "  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n",
       "  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n",
       "  --xr-border-color: var(--jp-border-color2, #e0e0e0);\n",
       "  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n",
       "  --xr-background-color: var(--jp-layout-color0, white);\n",
       "  --xr-background-color-row-even: var(--jp-layout-color1, white);\n",
       "  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n",
       "}\n",
       "\n",
       "html[theme=dark],\n",
       "body[data-theme=dark],\n",
       "body.vscode-dark {\n",
       "  --xr-font-color0: rgba(255, 255, 255, 1);\n",
       "  --xr-font-color2: rgba(255, 255, 255, 0.54);\n",
       "  --xr-font-color3: rgba(255, 255, 255, 0.38);\n",
       "  --xr-border-color: #1F1F1F;\n",
       "  --xr-disabled-color: #515151;\n",
       "  --xr-background-color: #111111;\n",
       "  --xr-background-color-row-even: #111111;\n",
       "  --xr-background-color-row-odd: #313131;\n",
       "}\n",
       "\n",
       ".xr-wrap {\n",
       "  display: block !important;\n",
       "  min-width: 300px;\n",
       "  max-width: 700px;\n",
       "}\n",
       "\n",
       ".xr-text-repr-fallback {\n",
       "  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-header {\n",
       "  padding-top: 6px;\n",
       "  padding-bottom: 6px;\n",
       "  margin-bottom: 4px;\n",
       "  border-bottom: solid 1px var(--xr-border-color);\n",
       "}\n",
       "\n",
       ".xr-header > div,\n",
       ".xr-header > ul {\n",
       "  display: inline;\n",
       "  margin-top: 0;\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-obj-type,\n",
       ".xr-array-name {\n",
       "  margin-left: 2px;\n",
       "  margin-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-obj-type {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-sections {\n",
       "  padding-left: 0 !important;\n",
       "  display: grid;\n",
       "  grid-template-columns: 150px auto auto 1fr 20px 20px;\n",
       "}\n",
       "\n",
       ".xr-section-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-section-item input {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-item input + label {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label {\n",
       "  cursor: pointer;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-item input:enabled + label:hover {\n",
       "  color: var(--xr-font-color0);\n",
       "}\n",
       "\n",
       ".xr-section-summary {\n",
       "  grid-column: 1;\n",
       "  color: var(--xr-font-color2);\n",
       "  font-weight: 500;\n",
       "}\n",
       "\n",
       ".xr-section-summary > span {\n",
       "  display: inline-block;\n",
       "  padding-left: 0.5em;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label {\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in + label:before {\n",
       "  display: inline-block;\n",
       "  content: '►';\n",
       "  font-size: 11px;\n",
       "  width: 15px;\n",
       "  text-align: center;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:disabled + label:before {\n",
       "  color: var(--xr-disabled-color);\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label:before {\n",
       "  content: '▼';\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked + label > span {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-section-summary,\n",
       ".xr-section-inline-details {\n",
       "  padding-top: 4px;\n",
       "  padding-bottom: 4px;\n",
       "}\n",
       "\n",
       ".xr-section-inline-details {\n",
       "  grid-column: 2 / -1;\n",
       "}\n",
       "\n",
       ".xr-section-details {\n",
       "  display: none;\n",
       "  grid-column: 1 / -1;\n",
       "  margin-bottom: 5px;\n",
       "}\n",
       "\n",
       ".xr-section-summary-in:checked ~ .xr-section-details {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-array-wrap {\n",
       "  grid-column: 1 / -1;\n",
       "  display: grid;\n",
       "  grid-template-columns: 20px auto;\n",
       "}\n",
       "\n",
       ".xr-array-wrap > label {\n",
       "  grid-column: 1;\n",
       "  vertical-align: top;\n",
       "}\n",
       "\n",
       ".xr-preview {\n",
       "  color: var(--xr-font-color3);\n",
       "}\n",
       "\n",
       ".xr-array-preview,\n",
       ".xr-array-data {\n",
       "  padding: 0 5px !important;\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-array-data,\n",
       ".xr-array-in:checked ~ .xr-array-preview {\n",
       "  display: none;\n",
       "}\n",
       "\n",
       ".xr-array-in:checked ~ .xr-array-data,\n",
       ".xr-array-preview {\n",
       "  display: inline-block;\n",
       "}\n",
       "\n",
       ".xr-dim-list {\n",
       "  display: inline-block !important;\n",
       "  list-style: none;\n",
       "  padding: 0 !important;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list li {\n",
       "  display: inline-block;\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "}\n",
       "\n",
       ".xr-dim-list:before {\n",
       "  content: '(';\n",
       "}\n",
       "\n",
       ".xr-dim-list:after {\n",
       "  content: ')';\n",
       "}\n",
       "\n",
       ".xr-dim-list li:not(:last-child):after {\n",
       "  content: ',';\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-has-index {\n",
       "  font-weight: bold;\n",
       "}\n",
       "\n",
       ".xr-var-list,\n",
       ".xr-var-item {\n",
       "  display: contents;\n",
       "}\n",
       "\n",
       ".xr-var-item > div,\n",
       ".xr-var-item label,\n",
       ".xr-var-item > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-even);\n",
       "  margin-bottom: 0;\n",
       "}\n",
       "\n",
       ".xr-var-item > .xr-var-name:hover span {\n",
       "  padding-right: 5px;\n",
       "}\n",
       "\n",
       ".xr-var-list > li:nth-child(odd) > div,\n",
       ".xr-var-list > li:nth-child(odd) > label,\n",
       ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n",
       "  background-color: var(--xr-background-color-row-odd);\n",
       "}\n",
       "\n",
       ".xr-var-name {\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-var-dims {\n",
       "  grid-column: 2;\n",
       "}\n",
       "\n",
       ".xr-var-dtype {\n",
       "  grid-column: 3;\n",
       "  text-align: right;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-preview {\n",
       "  grid-column: 4;\n",
       "}\n",
       "\n",
       ".xr-index-preview {\n",
       "  grid-column: 2 / 5;\n",
       "  color: var(--xr-font-color2);\n",
       "}\n",
       "\n",
       ".xr-var-name,\n",
       ".xr-var-dims,\n",
       ".xr-var-dtype,\n",
       ".xr-preview,\n",
       ".xr-attrs dt {\n",
       "  white-space: nowrap;\n",
       "  overflow: hidden;\n",
       "  text-overflow: ellipsis;\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-var-name:hover,\n",
       ".xr-var-dims:hover,\n",
       ".xr-var-dtype:hover,\n",
       ".xr-attrs dt:hover {\n",
       "  overflow: visible;\n",
       "  width: auto;\n",
       "  z-index: 1;\n",
       "}\n",
       "\n",
       ".xr-var-attrs,\n",
       ".xr-var-data,\n",
       ".xr-index-data {\n",
       "  display: none;\n",
       "  background-color: var(--xr-background-color) !important;\n",
       "  padding-bottom: 5px !important;\n",
       "}\n",
       "\n",
       ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n",
       ".xr-var-data-in:checked ~ .xr-var-data,\n",
       ".xr-index-data-in:checked ~ .xr-index-data {\n",
       "  display: block;\n",
       "}\n",
       "\n",
       ".xr-var-data > table {\n",
       "  float: right;\n",
       "}\n",
       "\n",
       ".xr-var-name span,\n",
       ".xr-var-data,\n",
       ".xr-index-name div,\n",
       ".xr-index-data,\n",
       ".xr-attrs {\n",
       "  padding-left: 25px !important;\n",
       "}\n",
       "\n",
       ".xr-attrs,\n",
       ".xr-var-attrs,\n",
       ".xr-var-data,\n",
       ".xr-index-data {\n",
       "  grid-column: 1 / -1;\n",
       "}\n",
       "\n",
       "dl.xr-attrs {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  display: grid;\n",
       "  grid-template-columns: 125px auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt,\n",
       ".xr-attrs dd {\n",
       "  padding: 0;\n",
       "  margin: 0;\n",
       "  float: left;\n",
       "  padding-right: 10px;\n",
       "  width: auto;\n",
       "}\n",
       "\n",
       ".xr-attrs dt {\n",
       "  font-weight: normal;\n",
       "  grid-column: 1;\n",
       "}\n",
       "\n",
       ".xr-attrs dt:hover span {\n",
       "  display: inline-block;\n",
       "  background: var(--xr-background-color);\n",
       "  padding-right: 10px;\n",
       "}\n",
       "\n",
       ".xr-attrs dd {\n",
       "  grid-column: 2;\n",
       "  white-space: pre-wrap;\n",
       "  word-break: break-all;\n",
       "}\n",
       "\n",
       ".xr-icon-database,\n",
       ".xr-icon-file-text2,\n",
       ".xr-no-icon {\n",
       "  display: inline-block;\n",
       "  vertical-align: middle;\n",
       "  width: 1em;\n",
       "  height: 1.5em !important;\n",
       "  stroke-width: 0;\n",
       "  stroke: currentColor;\n",
       "  fill: currentColor;\n",
       "}\n",
       "</style><pre class='xr-text-repr-fallback'>&lt;xarray.Dataset&gt;\n",
       "Dimensions:             (lat: 360, lon: 720, time: 365, nbnds: 2)\n",
       "Coordinates:\n",
       "  * lat                 (lat) float32 89.75 89.25 88.75 ... -88.75 -89.25 -89.75\n",
       "  * lon                 (lon) float32 0.25 0.75 1.25 1.75 ... 358.8 359.2 359.8\n",
       "  * time                (time) object 0001-01-01 00:00:00 ... 0001-12-31 00:0...\n",
       "Dimensions without coordinates: nbnds\n",
       "Data variables:\n",
       "    climatology_bounds  (time, nbnds) datetime64[ns] ...\n",
       "    precip              (time, lat, lon) float32 ...\n",
       "    valid_yr_count      (time, lat, lon) float32 ...\n",
       "Attributes:\n",
       "    Conventions:                    CF-1.0\n",
       "    version:                        V1.0\n",
       "    history:                        Created 2021/02/09 by doDayLTM\n",
       "    title:                          CPC GLOBAL PRCP V1.0\n",
       "    dataset_title:                  CPC GLOBAL PRCP V1.0\n",
       "    Source:                         ftp://ftp.cpc.ncep.noaa.gov/precip/CPC_UN...\n",
       "    References:                     https://www.psl.noaa.gov/data/gridded/dat...\n",
       "    not_missing_threshold_percent:  minimum 3% values input to have non-missi...</pre><div class='xr-wrap' style='display:none'><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-d1379545-78ea-4aca-a341-abd141a6d0da' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-d1379545-78ea-4aca-a341-abd141a6d0da' class='xr-section-summary'  title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>lat</span>: 360</li><li><span class='xr-has-index'>lon</span>: 720</li><li><span class='xr-has-index'>time</span>: 365</li><li><span>nbnds</span>: 2</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-2d8b4814-64e4-471e-9f3d-4b9e11503000' class='xr-section-summary-in' type='checkbox'  checked><label for='section-2d8b4814-64e4-471e-9f3d-4b9e11503000' class='xr-section-summary' >Coordinates: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>lat</span></div><div class='xr-var-dims'>(lat)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>89.75 89.25 88.75 ... -89.25 -89.75</div><input id='attrs-3a3c6a7a-ff44-4eaa-a8af-080f4bfd7f40' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-3a3c6a7a-ff44-4eaa-a8af-080f4bfd7f40' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-02ad03b8-de39-42f5-bc1a-a4136fc7bd1c' class='xr-var-data-in' type='checkbox'><label for='data-02ad03b8-de39-42f5-bc1a-a4136fc7bd1c' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>actual_range :</span></dt><dd>[ 89.75 -89.75]</dd><dt><span>long_name :</span></dt><dd>Latitude</dd><dt><span>units :</span></dt><dd>degrees_north</dd><dt><span>axis :</span></dt><dd>Y</dd><dt><span>standard_name :</span></dt><dd>latitude</dd><dt><span>coordinate_defines :</span></dt><dd>center</dd></dl></div><div class='xr-var-data'><pre>array([ 89.75,  89.25,  88.75, ..., -88.75, -89.25, -89.75], dtype=float32)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>lon</span></div><div class='xr-var-dims'>(lon)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>0.25 0.75 1.25 ... 359.2 359.8</div><input id='attrs-454c3e9e-8941-493b-83a5-78732a297f0b' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-454c3e9e-8941-493b-83a5-78732a297f0b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-9714fe3c-ca76-4114-92ea-2600cbc068f0' class='xr-var-data-in' type='checkbox'><label for='data-9714fe3c-ca76-4114-92ea-2600cbc068f0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>Longitude</dd><dt><span>units :</span></dt><dd>degrees_east</dd><dt><span>axis :</span></dt><dd>X</dd><dt><span>standard_name :</span></dt><dd>longitude</dd><dt><span>actual_range :</span></dt><dd>[2.5000e-01 3.5975e+02]</dd><dt><span>coordinate_defines :</span></dt><dd>center</dd></dl></div><div class='xr-var-data'><pre>array([2.5000e-01, 7.5000e-01, 1.2500e+00, ..., 3.5875e+02, 3.5925e+02,\n",
       "       3.5975e+02], dtype=float32)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>0001-01-01 00:00:00 ... 0001-12-...</div><input id='attrs-c62d0d53-5f00-479b-9998-50bca52d9f3b' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-c62d0d53-5f00-479b-9998-50bca52d9f3b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-7f894a87-1ed9-447b-909d-3219a3ce0d22' class='xr-var-data-in' type='checkbox'><label for='data-7f894a87-1ed9-447b-909d-3219a3ce0d22' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>Time</dd><dt><span>axis :</span></dt><dd>T</dd><dt><span>standard_name :</span></dt><dd>time</dd><dt><span>coordinate_defines :</span></dt><dd>start</dd><dt><span>delta_t :</span></dt><dd>0000-00-01 00:00:00</dd><dt><span>prev_avg_period :</span></dt><dd>0000-00-01 00:00:00</dd><dt><span>avg_period :</span></dt><dd>0030-00-00 00:00:00</dd><dt><span>climatology :</span></dt><dd>climatology_bounds</dd><dt><span>climo_period :</span></dt><dd>1991/01/01 - 2020/12/31</dd><dt><span>actual_range :</span></dt><dd>[-16646328. -16637592.]</dd><dt><span>ltm_range :</span></dt><dd>[ 797688. 1060656.]</dd></dl></div><div class='xr-var-data'><pre>array([cftime.DatetimeGregorian(1, 1, 1, 0, 0, 0, 0, has_year_zero=False),\n",
       "       cftime.DatetimeGregorian(1, 1, 2, 0, 0, 0, 0, has_year_zero=False),\n",
       "       cftime.DatetimeGregorian(1, 1, 3, 0, 0, 0, 0, has_year_zero=False), ...,\n",
       "       cftime.DatetimeGregorian(1, 12, 29, 0, 0, 0, 0, has_year_zero=False),\n",
       "       cftime.DatetimeGregorian(1, 12, 30, 0, 0, 0, 0, has_year_zero=False),\n",
       "       cftime.DatetimeGregorian(1, 12, 31, 0, 0, 0, 0, has_year_zero=False)],\n",
       "      dtype=object)</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-5839a0d7-c26b-42bf-b640-22fd0e134e3c' class='xr-section-summary-in' type='checkbox'  checked><label for='section-5839a0d7-c26b-42bf-b640-22fd0e134e3c' class='xr-section-summary' >Data variables: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>climatology_bounds</span></div><div class='xr-var-dims'>(time, nbnds)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-817c44a6-c4bb-4af9-965d-06176772845e' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-817c44a6-c4bb-4af9-965d-06176772845e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-70bfb486-21f6-4873-a5e0-fb99d19ad013' class='xr-var-data-in' type='checkbox'><label for='data-70bfb486-21f6-4873-a5e0-fb99d19ad013' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>Climate Time Boundaries</dd></dl></div><div class='xr-var-data'><pre>[730 values with dtype=datetime64[ns]]</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>precip</span></div><div class='xr-var-dims'>(time, lat, lon)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-24d19bde-2e86-4466-8267-70f16f0ce41b' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-24d19bde-2e86-4466-8267-70f16f0ce41b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-4074ffe2-0b28-420b-9c6d-a84dbebbf0c0' class='xr-var-data-in' type='checkbox'><label for='data-4074ffe2-0b28-420b-9c6d-a84dbebbf0c0' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>var_desc :</span></dt><dd>Precipitation</dd><dt><span>level_desc :</span></dt><dd>Surface</dd><dt><span>statistic :</span></dt><dd>Long Term Mean</dd><dt><span>parent_stat :</span></dt><dd>Total</dd><dt><span>long_name :</span></dt><dd>Daily Long Term Mean total of precipitation</dd><dt><span>cell_methods :</span></dt><dd>time: mean within days time: mean over days time: mean over years</dd><dt><span>avg_period :</span></dt><dd>0000-00-01 00:00:00</dd><dt><span>units :</span></dt><dd>mm</dd><dt><span>valid_range :</span></dt><dd>[   0. 1000.]</dd><dt><span>dataset :</span></dt><dd>CPC Global Precipitation</dd><dt><span>actual_range :</span></dt><dd>[  0.     327.2972]</dd></dl></div><div class='xr-var-data'><pre>[94608000 values with dtype=float32]</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>valid_yr_count</span></div><div class='xr-var-dims'>(time, lat, lon)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>...</div><input id='attrs-f81cff11-81b4-4a32-953c-581a7d971168' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-f81cff11-81b4-4a32-953c-581a7d971168' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-e1697029-92a9-4bf2-a33c-ac0584811198' class='xr-var-data-in' type='checkbox'><label for='data-e1697029-92a9-4bf2-a33c-ac0584811198' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>count of non-missing values used in mean</dd></dl></div><div class='xr-var-data'><pre>[94608000 values with dtype=float32]</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-2a910c30-9a38-48e0-a965-278d1b833b04' class='xr-section-summary-in' type='checkbox'  ><label for='section-2a910c30-9a38-48e0-a965-278d1b833b04' class='xr-section-summary' >Indexes: <span>(3)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-index-name'><div>lat</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-2eeb7bb4-4740-4aad-85f2-13beafc87253' class='xr-index-data-in' type='checkbox'/><label for='index-2eeb7bb4-4740-4aad-85f2-13beafc87253' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([ 89.75,  89.25,  88.75,  88.25,  87.75,  87.25,  86.75,  86.25,\n",
       "               85.75,  85.25,\n",
       "              ...\n",
       "              -85.25, -85.75, -86.25, -86.75, -87.25, -87.75, -88.25, -88.75,\n",
       "              -89.25, -89.75],\n",
       "             dtype=&#x27;float64&#x27;, name=&#x27;lat&#x27;, length=360))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>lon</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-26afadf4-c500-4e25-bdb7-91dc8d99a06d' class='xr-index-data-in' type='checkbox'/><label for='index-26afadf4-c500-4e25-bdb7-91dc8d99a06d' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(Float64Index([  0.25,   0.75,   1.25,   1.75,   2.25,   2.75,   3.25,   3.75,\n",
       "                4.25,   4.75,\n",
       "              ...\n",
       "              355.25, 355.75, 356.25, 356.75, 357.25, 357.75, 358.25, 358.75,\n",
       "              359.25, 359.75],\n",
       "             dtype=&#x27;float64&#x27;, name=&#x27;lon&#x27;, length=720))</pre></div></li><li class='xr-var-item'><div class='xr-index-name'><div>time</div></div><div class='xr-index-preview'>PandasIndex</div><div></div><input id='index-700c3959-4866-4094-8b92-55fb333bf0eb' class='xr-index-data-in' type='checkbox'/><label for='index-700c3959-4866-4094-8b92-55fb333bf0eb' title='Show/Hide index repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-index-data'><pre>PandasIndex(CFTimeIndex([0001-01-01 00:00:00, 0001-01-02 00:00:00, 0001-01-03 00:00:00,\n",
       "             0001-01-04 00:00:00, 0001-01-05 00:00:00, 0001-01-06 00:00:00,\n",
       "             0001-01-07 00:00:00, 0001-01-08 00:00:00, 0001-01-09 00:00:00,\n",
       "             0001-01-10 00:00:00,\n",
       "             ...\n",
       "             0001-12-22 00:00:00, 0001-12-23 00:00:00, 0001-12-24 00:00:00,\n",
       "             0001-12-25 00:00:00, 0001-12-26 00:00:00, 0001-12-27 00:00:00,\n",
       "             0001-12-28 00:00:00, 0001-12-29 00:00:00, 0001-12-30 00:00:00,\n",
       "             0001-12-31 00:00:00],\n",
       "            dtype=&#x27;object&#x27;, length=365, calendar=&#x27;gregorian&#x27;, freq=&#x27;D&#x27;))</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-1fd72a32-f8a5-4f78-9f45-3af7c2604af3' class='xr-section-summary-in' type='checkbox'  checked><label for='section-1fd72a32-f8a5-4f78-9f45-3af7c2604af3' class='xr-section-summary' >Attributes: <span>(8)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>Conventions :</span></dt><dd>CF-1.0</dd><dt><span>version :</span></dt><dd>V1.0</dd><dt><span>history :</span></dt><dd>Created 2021/02/09 by doDayLTM</dd><dt><span>title :</span></dt><dd>CPC GLOBAL PRCP V1.0</dd><dt><span>dataset_title :</span></dt><dd>CPC GLOBAL PRCP V1.0</dd><dt><span>Source :</span></dt><dd>ftp://ftp.cpc.ncep.noaa.gov/precip/CPC_UNI_PRCP/</dd><dt><span>References :</span></dt><dd>https://www.psl.noaa.gov/data/gridded/data.cpc.globalprecip.html</dd><dt><span>not_missing_threshold_percent :</span></dt><dd>minimum 3% values input to have non-missing output value</dd></dl></div></li></ul></div></div>"
      ],
      "text/plain": [
       "<xarray.Dataset>\n",
       "Dimensions:             (lat: 360, lon: 720, time: 365, nbnds: 2)\n",
       "Coordinates:\n",
       "  * lat                 (lat) float32 89.75 89.25 88.75 ... -88.75 -89.25 -89.75\n",
       "  * lon                 (lon) float32 0.25 0.75 1.25 1.75 ... 358.8 359.2 359.8\n",
       "  * time                (time) object 0001-01-01 00:00:00 ... 0001-12-31 00:0...\n",
       "Dimensions without coordinates: nbnds\n",
       "Data variables:\n",
       "    climatology_bounds  (time, nbnds) datetime64[ns] ...\n",
       "    precip              (time, lat, lon) float32 ...\n",
       "    valid_yr_count      (time, lat, lon) float32 ...\n",
       "Attributes:\n",
       "    Conventions:                    CF-1.0\n",
       "    version:                        V1.0\n",
       "    history:                        Created 2021/02/09 by doDayLTM\n",
       "    title:                          CPC GLOBAL PRCP V1.0\n",
       "    dataset_title:                  CPC GLOBAL PRCP V1.0\n",
       "    Source:                         ftp://ftp.cpc.ncep.noaa.gov/precip/CPC_UN...\n",
       "    References:                     https://www.psl.noaa.gov/data/gridded/dat...\n",
       "    not_missing_threshold_percent:  minimum 3% values input to have non-missi..."
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 气候态降水\n",
    "pre=xr.open_dataset('./data/precip.day.ltm.nc')\n",
    "pre"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "*************************************************************************\n",
      "使用参数 filter_by_keys = {'stepType': 'avgid'}查看到的数据内容为：\n",
      "<xarray.Dataset>\n",
      "Dimensions:     (time: 492, latitude: 41, longitude: 31)\n",
      "Coordinates:\n",
      "    number      int32 ...\n",
      "  * time        (time) datetime64[ns] 1980-01-01 1980-02-01 ... 2020-12-01\n",
      "    step        timedelta64[ns] ...\n",
      "    surface     float64 ...\n",
      "  * latitude    (latitude) float64 26.0 25.9 25.8 25.7 ... 22.3 22.2 22.1 22.0\n",
      "  * longitude   (longitude) float64 109.0 109.1 109.2 ... 111.8 111.9 112.0\n",
      "    valid_time  (time) datetime64[ns] ...\n",
      "Data variables:\n",
      "    u10         (time, latitude, longitude) float32 ...\n",
      "    v10         (time, latitude, longitude) float32 ...\n",
      "    d2m         (time, latitude, longitude) float32 ...\n",
      "    t2m         (time, latitude, longitude) float32 ...\n",
      "    sp          (time, latitude, longitude) float32 ...\n",
      "Attributes:\n",
      "    GRIB_edition:            1\n",
      "    GRIB_centre:             ecmf\n",
      "    GRIB_centreDescription:  European Centre for Medium-Range Weather Forecasts\n",
      "    GRIB_subCentre:          0\n",
      "    Conventions:             CF-1.7\n",
      "    institution:             European Centre for Medium-Range Weather Forecasts\n",
      "    history:                 2023-04-30T14:10 GRIB to CDM+CF via cfgrib-0.9.1...\n",
      "\n",
      "请根据以上数据内容信息，确认所需读取的物理量对应的levelType\n",
      "*************************************************************************\n",
      "使用参数 filter_by_keys = {'stepType': 'avgua'}查看到的数据内容为：\n",
      "<xarray.Dataset>\n",
      "Dimensions:     (time: 492, latitude: 41, longitude: 31)\n",
      "Coordinates:\n",
      "    number      int32 ...\n",
      "  * time        (time) datetime64[ns] 1980-01-01 1980-02-01 ... 2020-12-01\n",
      "    step        timedelta64[ns] ...\n",
      "    surface     float64 ...\n",
      "  * latitude    (latitude) float64 26.0 25.9 25.8 25.7 ... 22.3 22.2 22.1 22.0\n",
      "  * longitude   (longitude) float64 109.0 109.1 109.2 ... 111.8 111.9 112.0\n",
      "    valid_time  (time) datetime64[ns] ...\n",
      "Data variables:\n",
      "    skt         (time, latitude, longitude) float32 ...\n",
      "Attributes:\n",
      "    GRIB_edition:            1\n",
      "    GRIB_centre:             ecmf\n",
      "    GRIB_centreDescription:  European Centre for Medium-Range Weather Forecasts\n",
      "    GRIB_subCentre:          0\n",
      "    Conventions:             CF-1.7\n",
      "    institution:             European Centre for Medium-Range Weather Forecasts\n",
      "    history:                 2023-04-30T14:10 GRIB to CDM+CF via cfgrib-0.9.1...\n",
      "\n",
      "请根据以上数据内容信息，确认所需读取的物理量对应的levelType\n",
      "*************************************************************************\n",
      "使用参数 filter_by_keys = {'stepType': 'avgas'}查看到的数据内容为：\n",
      "<xarray.Dataset>\n",
      "Dimensions:     (time: 264, latitude: 41, longitude: 31)\n",
      "Coordinates:\n",
      "    number      int32 ...\n",
      "  * time        (time) datetime64[ns] 1980-01-01 1980-02-01 ... 2001-12-01\n",
      "    step        timedelta64[ns] ...\n",
      "    surface     float64 ...\n",
      "  * latitude    (latitude) float64 26.0 25.9 25.8 25.7 ... 22.3 22.2 22.1 22.0\n",
      "  * longitude   (longitude) float64 109.0 109.1 109.2 ... 111.8 111.9 112.0\n",
      "    valid_time  (time) datetime64[ns] ...\n",
      "Data variables:\n",
      "    tp          (time, latitude, longitude) float32 ...\n",
      "Attributes:\n",
      "    GRIB_edition:            1\n",
      "    GRIB_centre:             ecmf\n",
      "    GRIB_centreDescription:  European Centre for Medium-Range Weather Forecasts\n",
      "    GRIB_subCentre:          0\n",
      "    Conventions:             CF-1.7\n",
      "    institution:             European Centre for Medium-Range Weather Forecasts\n",
      "    history:                 2023-04-30T14:10 GRIB to CDM+CF via cfgrib-0.9.1...\n",
      "\n",
      "请根据以上数据内容信息，确认所需读取的物理量对应的levelType\n",
      "*************************************************************************\n",
      "使用参数 filter_by_keys = {'stepType': 'avgad'}查看到的数据内容为：\n",
      "<xarray.Dataset>\n",
      "Dimensions:     (time: 228, latitude: 41, longitude: 31)\n",
      "Coordinates:\n",
      "    number      int32 ...\n",
      "  * time        (time) datetime64[ns] 2002-01-01 2002-02-01 ... 2020-12-01\n",
      "    step        timedelta64[ns] ...\n",
      "    surface     float64 ...\n",
      "  * latitude    (latitude) float64 26.0 25.9 25.8 25.7 ... 22.3 22.2 22.1 22.0\n",
      "  * longitude   (longitude) float64 109.0 109.1 109.2 ... 111.8 111.9 112.0\n",
      "    valid_time  (time) datetime64[ns] ...\n",
      "Data variables:\n",
      "    tp          (time, latitude, longitude) float32 ...\n",
      "Attributes:\n",
      "    GRIB_edition:            1\n",
      "    GRIB_centre:             ecmf\n",
      "    GRIB_centreDescription:  European Centre for Medium-Range Weather Forecasts\n",
      "    GRIB_subCentre:          0\n",
      "    Conventions:             CF-1.7\n",
      "    institution:             European Centre for Medium-Range Weather Forecasts\n",
      "    history:                 2023-04-30T14:11 GRIB to CDM+CF via cfgrib-0.9.1...\n",
      "\n",
      "请根据以上数据内容信息，确认所需读取的物理量对应的levelType\n",
      "在读取数据时需添加如下参数当中的一个\n",
      "filter_by_keys = {'stepType': 'avgid'}\n",
      "filter_by_keys = {'stepType': 'avgua'}\n",
      "filter_by_keys = {'stepType': 'avgas'}\n",
      "filter_by_keys = {'stepType': 'avgad'}\n"
     ]
    }
   ],
   "source": [
    "# land\n",
    "import xarray as xr\n",
    "import cfgrib\n",
    "import meteva.base as meb\n",
    "# lands=xr.open_dataset('./data/land_monthly.grib',engine='cfgrib',)\n",
    "# lands\n",
    "meb.print_grib_file_info('./data/land_monthly.grib')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "lands=xr.open_dataset('./data/land_monthly.grib',engine='cfgrib',backend_kwargs={'filter_by_keys':{'stepType': 'avgid','typeOfLevel': 'surface'}})\n",
    "lands"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
